//
//  SinaBaseNavVCViewController.swift
//  mySina
//
//  Created by 刘莹 on 2016/11/12.
//  Copyright © 2016年 liuying. All rights reserved.
//

import UIKit

class SinaBaseNavVCViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    //MARK: -
    //MARK: - 重写push方法
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        let count = childViewControllers.count
        
        if count>0{
        
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(backVC))
            //隐藏底部的tabbar
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    //MARK: -
    //MARK: - 返回控制器
   @objc func backVC(){
    
    popViewController(animated: true)
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
